let data_counts = document.querySelectorAll('.data_count')

data_counts.forEach(item => {

  const updateNumber = ()=>{
    // +item.getAttribute('data-target') 一元运算符：在操作数字之前时 如果变量不是数字类型会尝试转为数字
    const target = +item.getAttribute('data-target')

    const cur_number = +item.innerText
    // 增量的值越大 到达目标数量就越快
    const increment = target / 200

    if (cur_number < target) {
      item.innerText = `${Math.ceil(cur_number + increment)}`
      setTimeout(updateNumber, 1)
    }else{
      item.innerText = target
    }
  }

  updateNumber()
});

